import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * This class represents the abstract Supertype for any concrete Implementations of Cost.
 * 
 * @author (Dilyan GEORGIEV)
 * @author (Thomas KOBER)
 * @author (Matthew MCDONALD)
 * 
 * @version (1.0)
 */
public abstract class Cost extends Actor implements Cloneable
{ 
    ////////////////////////////////////////////////////////////////////////////////
    // Public Implementation
    ////////////////////////////////////////////////////////////////////////////////    

    /**
     * Returns the associated value of any concrete Implementation of Cost.
     * @return the associated value of any concrete Implementation of Cost.
     */
    public abstract int getValue();
    
    public boolean equals(Object o)
    {
        boolean equals = false;
        
        if (o != null) {
            if (o == this) {
                equals = true;
            } else {
                if (o instanceof Cost) {
                    Cost other = (Cost)o;
                    
                    if (this.getValue() == other.getValue()) {
                        equals = true;
                    }
                }
            }
        }   
        
        return false;
    }
    
    public int hashCode()
    {
        int result = 17;
        
        result = 31 * result + this.getValue();
        
        return result;
    }
    
    public Cost clone()
    {
        Cost theCopy = null;
        
        try {
            theCopy = (Cost)super.clone();
        } catch (CloneNotSupportedException ex) {
            ex.printStackTrace();
        }
        
        return theCopy;
    }
    
}
